package com.userautentification.dao.imp;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import com.userautentification.dao.DataAccessLayerException;
import com.userautentification.dao.PersonaDao;
import com.userautentification.entities.Persona;

@Repository("personaDao")
public class PersonaDaoImp extends GenericDaoHibernate<Persona, Long> implements
		PersonaDao {

	public PersonaDaoImp(Class<Persona> persona) {
		super(persona);

	}

	Log log = LogFactory.getLog(PersonaDaoImp.class);

	/**
	 * Insert a new Persona into the database.
	 * 
	 * @param persona
	 */
	public Persona save(Persona persona) throws DataAccessLayerException {
		return super.save(persona);
	}

	/**
	 * Delete a detached Persona from the database.
	 * 
	 * @param persona
	 */
	public void remove(Persona persona) throws DataAccessLayerException {
		super.remove(persona.getId());
	}

	/**
	 * Updates the state of a detached Persona.
	 * 
	 * @param persona
	 */
	public void update(Persona persona) throws DataAccessLayerException {
		super.save(persona);
	}

	/**
	 * Finds all Persona in the database.
	 * 
	 * @return
	 */
	public List getAll() throws DataAccessLayerException {
		return super.getAll();
	}

	/**
	 * Finds all distinct Persona in the database.
	 * 
	 * @return
	 */
	public List<Persona> getAllDistinct() {

		return super.getAllDistinct();

	}

	/**
	 * Finds a Persona in the database.
	 * 
	 * @return
	 */
	public Persona get(long id) {
		return super.get(id);
	}

	/**
	 * Return true if a Persona exist in the database.
	 * 
	 * @return
	 */
	public boolean exists(Long id) {
		return super.exists(id);
	}

	/**
	 * Return a list of Personas that exist in the database.
	 * 
	 * @return
	 */
	public List<Persona> findByNamedQuery(String queryName,
			Map<String, Object> queryParams) {
		return super.findByNamedQuery(queryName, queryParams);
	}

}